Using the Loading Box Component
The Loading Box component, included with the Macromedia Flash UI Components Set 3, provides a window with a loading animation. This is useful for situations when you need to give the user feedback on the application state, but do not have any indication of how long the state will take to change.
You can view a complete list of the API, as well as descriptions and examples, in the Macromedia Flash MX Reference Panel (Window > Reference Panel) under the Flash UI Components Set 3 section.
In most cases, you will want to use ActionScript to turn the Loading Box on and off. When you drag the Loading Box component into your movie, set its active state to false by setting the Active parameter in the Property inspector.
Then, in order activate the Loading Box, toggle its ActiveState using the setActiveState method of the component.
The example below displays the Loading Box while the XML is being loaded:
var x = new XML();
x.onLoad = function()
{
//XML has loaded. Turn of Loading Box
lBox.setActiveState(false);
}
x.load("myXML.xml");
//Turn on loading box
lBox.setActiveState(true);
The component comes with 4 animations. It also allows you to add or specify additional custom animations.
As you can see, the component is similar to search and copy dialog windows found on Windows and Macintosh platforms.
Sample files
Before you begin this tutorial, download the source file so that you can follow along in Macromedia Flash MX:
Customizing and controlling the Loading Box component
There are a number of ways to control and customize the component. Click on the button below to see an example.
The first step towards customizing the component involves using the Property inspector to specify the initial settings for the component. Here is a list of properties available and a short description of each:
- Title: The title to be displayed on the Loading Box.
- Message: The message to be displayed within the Loading Box.
- Animation: The animation to be used within the Loading box. The default options are none, flb_bar (a loading bar animation), flb_transfer (a file transfer animation), flb_copy (a file copy animation) and flb_delete (a file delete animation).
- Buttons: An array of strings containing the labels of desired buttons. A button will be created for each item within the array.
- Close Handler: A reference to the function to be called when one of the buttons is clicked.
- Button Width: Defines the width of the buttons.
- Titlebar Height: Defines the height of the title bar.
- Active: Denotes if the Loading Box is active, useable and visible when the SWF file starts.
You can also interact with and customize the Loading Box at runtime, by using the Loading Box's ActionScript API.
You can view a complete list of the API, as well as descriptions and examples, in the Macromedia Flash MX Reference Panel (Window > Reference Panel) under the Flash UI Components Set 3 section.
Finally, the component can be customized through the use of FStyleFormat properties. The following properties are supported:
- FStyleFormat.face
- FStyleFormat.highlight
- FStyleFormat.shadow
- FStyleFormat.darkshadow
- FStyleFormat.highlight3D
- FStyleFormat.textAlign
- FStyleFormat.textBold
- FStyleFormat.textColor
- FStyleFormat.textDisabled
- FStyleFormat.textFont
- FStyleFormat.textIndent
- FStyleFormat.textItalic
- FStyleFormat.textLeftMargin
- FStyleFormat.textRightMargin
- FStyleFormat.textSelected
- FStyleFormat.textSize
- FStyleFormat.textUnderline